home *** CD-ROM | disk | FTP | other *** search
/ Micromanía 93 / CDMM_93_2.ISO / Project Nomads / nomads_demo_eng.exe / SAMMLER_AVOIDCOLLISION.TCL < prev    next >
Encoding:
Text File  |  2000-09-25  |  2.5 KB  |  92 lines

  1. new nroot sammler/avoidcollision
  2. sel sammler/avoidcollision
  3.  
  4. # --------------------------------------------------------------------
  5. # Sammler, der kuemmert sich eigentlich nur um grosse Sachen, deswegen 
  6. # lassen wir die tests auch einfach.
  7. # --------------------------------------------------------------------
  8. new ncommandlist avoidleft
  9. avoidleft.setadjusttype    horimaneuver
  10. avoidleft.settestcommand   sacleft_test
  11. avoidleft.addcommand true -100 0 0 false 0 0 0 nothing 2.0
  12.  
  13. proc sacleft_test {} { 
  14.  
  15.     if {[.getavoidcollisiondirection] == "left"} {
  16.         return 1.0
  17.     } else {
  18.         return 0.0
  19.     }
  20. }
  21.  
  22. new ncommandlist avoidright
  23. avoidright.setadjusttype    horimaneuver
  24. avoidright.settestcommand   sacright_test
  25. avoidright.addcommand true 100 0 0 false 0 0 0 nothing 2.0
  26.  
  27. proc sacright_test {} { 
  28.  
  29.     if {[.getavoidcollisiondirection] == "right"} {
  30.         return 1.0
  31.     } else {
  32.         return 0.0
  33.     }
  34. }
  35.  
  36. new ncommandlist avoidup
  37. avoidup.setadjusttype    horimaneuver
  38. avoidup.settestcommand   sacup_test
  39. avoidup.addcommand true 0 100 -50 false 0 0 0 nothing 2.0
  40.  
  41. proc sacup_test {} { 
  42.  
  43.     if {[.getavoidcollisiondirection] == "up"} {
  44.         return 1.0
  45.     } else {
  46.         return 0.0
  47.     }
  48. }
  49.  
  50. new ncommandlist avoiddown
  51. avoiddown.setadjusttype    horimaneuver
  52. avoiddown.settestcommand   sacdown_test
  53. avoiddown.addcommand true 0 -100 -50 false 0 0 0 nothing 2.0
  54.  
  55. proc sacdown_test {} { 
  56.  
  57.     if {[.getavoidcollisiondirection] == "down"} {
  58.         return 1.0
  59.     } else {
  60.         return 0.0
  61.     }
  62. }
  63.  
  64.  
  65. #--------------------------------------------------------------
  66. # Ausnahmebehandlung: Anscheinend passiert folgende Situation: 
  67. # eine erwartete Kollision bringt uns in den zustand, aber dann
  68. # wurde das Modul schon wieder getriggert ohne eine Kollision
  69. # zu melden. Dafuer machen wir noch ein kurzes Script.
  70. # Ausserdem, und das wird der hauptgrund sein, wird zwar der
  71. # Zustand nach abarbeitung der ersten Liste abgebrochen, aber
  72. # das Modul such noch eine weitere Liste. Also bieten wir eine, 
  73. # auch wenn diese im naechsten Frame abgeschalten wird.
  74. #--------------------------------------------------------------
  75. new ncommandlist avoidnothing
  76. avoidnothing.setadjusttype    horimaneuver
  77. avoidnothing.settestcommand   aacnothing_test
  78. avoidnothing.addcommand true 0 0 -100 false 0 0 0 nothing 0.2
  79.  
  80. proc aacnothing_test {} { 
  81.  
  82.     if {[.getavoidcollisionkind] == "nothing"} {
  83.         return 1.0
  84.     } else {
  85.         return 0.0
  86.     }
  87. }
  88.  
  89. sel ..
  90. sel ..
  91.  
  92.